package com.xlhj.mongodb.controller;

import com.xlhj.mongodb.entity.SysUser;
import com.xlhj.mongodb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName UserController
 * @Description TODO
 * @Author liucaijing
 * @Date 2021/2/26 14:45
 * @Version 1.0
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/insertUser")
    public SysUser insertUser(@RequestBody SysUser user) {
        return userService.insertUser(user);
    }

    @GetMapping("/selectUserById")
    public SysUser selectUserById(Long id) {
        return userService.selectUserById(id);
    }
}
